@echo off
chcp 65001
setlocal ENABLEDELAYEDEXPANSION
cd /d %~dp0

if exist "liyan-com.js" (
	del "liyan-com.js"
)

set jsVersion=""
set jsPosition=""

::得到参数
for /f "eol=# usebackq" %%i in ("info.txt") do (
	for /f "usebackq tokens=1,2 delims==" %%a in ('%%i') do (
		if "%%a"=="version" (
			set jsVersion=%%b
		)
		if "%%a"=="position" (
			set jsPosition=%%b
		)
	)
)

::拷贝 liyan-com.js
if "%jsPosition%"=="" NOT (
	if "%jsVersion%"=="" NOT (
		call %jsPosition%\%jsVersion%\Generate.bat
		copy %jsPosition%\%jsVersion%\liyan-com.min.js liyan-com.js
	)
)

setlocal DISABLEDELAYEDEXPANSION

pause